/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wwy
 * Date: 2024-05-01
 * Time: 14:09
 */
public class ShuiXianHua {
    public static void main(String[] args) {
        for (int i = 0; i < 99999; i++) {
            int count=0;
            int tmp=i;
            while(tmp !=0){
                count++;
                tmp/=10;
            }
            tmp=i;
            int sum=0;
            while(tmp!=0){
                sum+=Math.pow(tmp%10,count);
                tmp/=10;
            }
            if(i==sum){
                System.out.println(i);
            }
        }
    }
}
